home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dld-3_23.lha / dld-3.2.3 / error.c < prev    next >
C/C++ Source or Header  |  1991-05-30  |  2KB  |  57 lines

  1. /* error.c -- print out the error strings. */
  2.  
  3. /* This file is part of DLD, a dynamic link/unlink editor for C.
  4.    
  5.    Copyright (C) 1990 by W. Wilson Ho.
  6.  
  7.    The author can be reached electronically by how@cs.ucdavis.edu or
  8.    through physical mail at:
  9.  
  10.    W. Wilson Ho
  11.    Division of Computer Science
  12.    University of California at Davis
  13.    Davis, CA 95616
  14.  */
  15.  
  16. /* This program is free software; you can redistribute it and/or modify it
  17.    under the terms of the GNU General Public License as published by the
  18.    Free Software Foundation; either version 1, or (at your option) any
  19.    later version. */
  20.  
  21. #include "defs.h"
  22.  
  23. static char *errlst[] = {
  24.     "Error 0",
  25.     "cannot open file",            /* 1 DLD_ENOFILE */
  26.     "bad magic number",            /* 2 DLD_EBADMAGIC */
  27.     "fail to read header",        /* 3 DLD_EBADHEADER */
  28.     "premature eof in text section",    /* 4 DLD_ENOTEXT */
  29.     "premature eof in symbols",        /* 5 DLD_ENOSYMBOLS */
  30.     "bad string table",            /* 6 DLD_ENOSTRINGS */
  31.     "premature eof in text relocation",    /* 7 DLD_ENOTXTRELOC */
  32.     "premature eof in data section",    /* 8 DLD_ENODATA */
  33.     "premature eof in data relocation",    /* 9 DLD_ENODATRELOC */
  34.     "multiple definitions of symbol",    /* 10 DLD_EMULTDEFS */
  35.     "malformed library archive",    /* 11 DLD_EBADLIBRARY */
  36.     "common block not supported",    /* 12 DLD_EBADCOMMON */
  37.     "malformed input file",        /* 13 DLD_EBADOBJECT */
  38.     "bad relocation info",        /* 14 DLD_EBADRELOC */
  39.     "virtual memory exhausted",        /* 15 DLD_ENOMEMORY */
  40.     "undefined symbol"            /* 16 DLD_EUNDEFSYM */
  41.     };
  42.  
  43.  
  44. /* Prints out the given string and the error message corresponding to
  45.    dld_errno to the stderr. */
  46. void
  47. dld_perror (str)
  48. char *str;
  49. {
  50.     if (str)
  51.     fprintf (stderr, "%s: ", str);
  52.     
  53.     if (dld_errno < 1 || dld_errno > sizeof (errlst)/sizeof (char *))
  54.     fprintf (stderr, "Unknown error.\n");
  55.     else fprintf (stderr, "%s.\n", errlst[dld_errno]);
  56. } /* dld_perror */
  57.